package socketinterface;

import java.io.DataInputStream;
import java.io.IOException;

import com.vast.ui.component.models.Led;
import com.vast.ui.ledpanel.views.ViewPart;

public class InitializeLed implements ICommandPacket {
	public  ViewPart          view;
	private DataInputStream   in = null;
	private Logger            logger;
	
	public InitializeLed(ViewPart view, DataInputStream   in, Logger logger) {
		this.view   = view;
		this.in     = in;
		this.logger = logger;
	}

	public void execute() throws IOException {
		// TODO Auto-generated method stub
		final int numberOfLed  = in.readInt();
		final int value        = in.readInt();
		//view.initLedPanel(view.viewer, view.ledPanel, numberOfLed, value);
		//view.ledPanel.getList().clear();
		//for(int i = 0; i < numberOfLed; i++) {
		//	Led led = new Led(i, value);	
		//	view.ledPanel.add(led);
		//}
		
		view.display.syncExec(new Runnable() {
			public void run() {
				//view.viewer.setInput(view.ledPanel);
				view.initLedPanel(view.viewer, view.ledPanel, numberOfLed, value);
			}
		});
		
		
	} 
}
